/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: ComCfg.c
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: Com
*
*******************************************************************************/

/** HEADER FILES **/
#include "ComCfg.h"


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/


/** LOCAL DATA DECLARATION **/
const Com_SignalConfigType Com_TxSignal[ComConf_ComTxSignalCfg_Signal_Max];
const Com_SignalConfigType Com_RxSignal[ComConf_ComRxSignalCfg_Signal_Max];


/** LOCAL DATA **/
uint8 Com_TxPduBuffer_YT_Can1[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8 Com_TxPduBuffer_YT_Can2[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

uint8 Com_RxPduBuffer_Other_Can1[8] = {0x00};
uint8 Com_RxPduBuffer_Other_Can2[8] = {0x00};


uint8 Com_TxSignalBuffer[12] = {0x00};
uint8 Com_RxSignalBuffer[10];

uint8 Com_TxPduUpdateBitBuffer = 0x00;
uint8 Com_RxPduUpdateBitBuffer = 0x00;

uint8 Com_TxSignalUpdateBitBuffer[2] = {0x00};
uint8 Com_RxSignalUpdateBitBuffer[2] = {0x00};



const Com_SignalConfigType Com_TxSignal[ComConf_ComTxSignalCfg_Signal_Max] = 
{
    /* bitPosition, bitSize, signalLength,  signalInitValue, comHandleId, signalType,             signalEndianness,            signalBufferPtr */
    {23u,           10u,     2u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_TxSignalBuffer[0]}, /* Tx_YT_Can1_SignalA */
    {31u,           10u,     2u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_LITTLE_ENDIAN,    (uint8*)&Com_TxSignalBuffer[2]}, /* Tx_YT_Can1_SignalB */
    {63u,           3u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_TxSignalBuffer[4]}, /* Tx_YT_Can1_SignalC */
    {55u,           3u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_LITTLE_ENDIAN,    (uint8*)&Com_TxSignalBuffer[5]},   /* Tx_YT_Can1_SignalD */

    {26u,           28u,     4u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_TxSignalBuffer[6]}, /* Tx_YT_Can2_SignalA */
    {40u,           8u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_TxSignalBuffer[10]}, /* Tx_YT_Can2_SignalB */
    {58u,           2u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_TxSignalBuffer[11]}    /* Tx_YT_Can2_SignalC */
};


const Com_SignalConfigType Com_RxSignal[ComConf_ComRxSignalCfg_Signal_Max] = 
{
    /* bitPosition, bitSize, signalLength,  signalInitValue, comHandleId, signalType,             signalEndianness,            signalBufferPtr */
    {26u,           25u,     2u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_RxSignalBuffer[0]}, /* Rx_Other_Can1_SignalA */
    {39u,           10u,     2u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_LITTLE_ENDIAN,    (uint8*)&Com_RxSignalBuffer[4]}, /* Rx_Other_Can1_SignalB */
    {51u,           5u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_RxSignalBuffer[6]}, /* Rx_Other_Can1_SignalC */
    {59u,           5u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_LITTLE_ENDIAN,    (uint8*)&Com_RxSignalBuffer[7]},   /* Rx_Other_Can1_SignalD */

    {29u,           3u,      4u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_RxSignalBuffer[8]}, /* Rx_Other_Can2_SignalA */
    {61u,           2u,      1u,            0x00,            0u,          COM_SIGNAL_TYPE_UINT8,  COM_SIGNAL_BIG_ENDIAN,       (uint8*)&Com_RxSignalBuffer[9]} /* Rx_Other_Can2_SignalB */
};


const Com_PduConfigType Com_TxPduConfig[ComConf_ComTxPduCfg_Pdu_Max] = 
{
    /* signalPtr,                                                                             signalNumber,                                pduId,                                     pduPtr,                        comIPduType,          comTxIPdu */
                                                                                                                                                                                                                                           /* UnusedAreasDefault, minimumDelayTime, txIPduClearUpdateBit,                  timePeriod, timeOffset, mode */
    {(Com_SignalConfigType*)&Com_TxSignal[ComConf_ComTxSignalCfg_Signal_YT_Can1_First],      ComConf_ComTxSignalCfg_Signal_YT_Can1_Max,   ComConf_ComTxPduCfg_Pdu_YT_Can1_0x101,     Com_TxPduBuffer_YT_Can1,     COM_IPDU_TYPE_NORMAL, {0x00,                 0x01,             COM_IPDU_TX_CLEAR_UPDATE_BIT_TRANSMIT, {100u,      0u,         COM_TX_MODE_PERIODIC}}},
    {(Com_SignalConfigType*)&Com_TxSignal[ComConf_ComTxSignalCfg_Signal_YT_Can2_First],      ComConf_ComTxSignalCfg_Signal_YT_Can2_Max,   ComConf_ComTxPduCfg_Pdu_YT_Can2_0x102,     Com_TxPduBuffer_YT_Can2,     COM_IPDU_TYPE_NORMAL, {0x00,                 0x01,             COM_IPDU_TX_CLEAR_UPDATE_BIT_TRANSMIT, {20u,       0u,         COM_TX_MODE_PERIODIC}}},
};


const Com_PduConfigType Com_RxPduConfig[ComConf_ComRxPduCfg_Pdu_Max] = 
{
    /* signalPtr,                                                                                signalNumber,                                pduId,                                     pduPtr,                            comIPduType,          comTxIPdu */
    {(Com_SignalConfigType*)&Com_RxSignal[ComConf_ComRxSignalCfg_Signal_Other_Can1_First],      ComConf_ComTxSignalCfg_Signal_YT_Can1_Max,   ComConf_ComTxPduCfg_Pdu_YT_Can1_0x101,     Com_RxPduBuffer_Other_Can1,     COM_IPDU_TYPE_NORMAL, {0x00}},
    {(Com_SignalConfigType*)&Com_RxSignal[ComConf_ComTxSignalCfg_Signal_Other_Can2_First],      ComConf_ComTxSignalCfg_Signal_YT_Can2_Max,   ComConf_ComTxPduCfg_Pdu_YT_Can2_0x102,     Com_RxPduBuffer_Other_Can2,     COM_IPDU_TYPE_NORMAL, {0x00}},
};



